<template>
	<view class="detail">
		<view style="width: 750rpx; height: 500rpx;">
			<image style="width: 750rpx; height: 500rpx;" :src="config.url + '/lsqApi' + goodsInfo.imagePath.split(',')[0]"></image>
		</view>
		<view class="bg-red padding">
			<view class="text-lg text-bold" v-if="goodsInfo.type == 2">￥{{goodsInfo.price}} 积分</view>
			<view class="text-lg text-bold" v-else>￥{{goodsInfo.price}} 绑定积分</view>
		</view>
		<view class="bg-white padding">
			<view class="cu-tag radius bg-red">精选</view>
			<text class="text-lg text-bold margin-left-sm">{{goodsInfo.name + goodsInfo.ms}}</text>
		</view>
		
		<view class="bg-white text-center">
			<image v-for="v in goodsInfo.imagePath.split(',')" :src="config.url + '/lsqApi' + v"></image>
		</view>
		
		<view class="myBar cu-bar bg-white tabbar border shop">
			<button class="action" open-type="contact" style="width: 50%;">
				<view class="cuIcon-service text-green">
					<view class="cu-tag badge"></view>
				</view>
				客服
			</button>
			<!-- <view class="action" @click="goto('/pages/shop/shoppingCart/index')">
				<view class="cuIcon-cart">
					<view class="cu-tag badge">99</view>
				</view>
				购物车
			</view> -->
			<!-- <view class="bg-orange submit">加入购物车</view> -->
			<view class="bg-red submit" @click="submit">立即订购</view>
		</view>
	</view>
</template>

<script>
import productApi from '../../../api/new/productApi'
import config from '../../../config'
	export default{
		data() {
			return {
				config: config,
				id: "",
				goodsInfo: ""
			}
		},
		onLoad(option) {
			this.id = option.id
			this.getGoodsDetail()
		},
		methods: {
			getGoodsDetail() {
				productApi.detail({id: this.id}).then(res => {
					this.goodsInfo = res.data
				})
			},
			submit() {
				this.goto("/pages/shop/createOrder/index?id=" + this.id)
			}
		}
	}
</script>

<style lang="scss">
	.detail{
		padding-bottom: 100rpx;
		.myBar{
			position: fixed;
			bottom: 0;
			width: 750rpx;
		}
	}
</style>